<?php
/**
 * index.php
 * this is entry point in this application
 */
//error_reporting(0);
session_start();
if(isset($_SESSION['users_username']) && isset($_SESSION['users_password'])){
	require_once './core/data/userdata.php';
	$session = new Core_Data_UserData();
	$name = $_SESSION['users_username'];
	$password = $_SESSION['users_password'];
	$session->getUserDataFromDatabase($name, $password);
}
require_once './core/models/logger.php';
$logger = new Core_Model_Logger();
$logger->saveData();
try {
	
	if(file_exists("./configurationloader.php")){
		require_once './configurationloader.php';
	}
	
	else {
		throw new Exception("Framework could not load file: '<strong>./configurationloader.php</strong>'!");
	}
	
}

catch(Exception $e){
	echo $e->getMessage();
}

// fetch the passed request
$request = $_SERVER['QUERY_STRING'];
$postVars = $_POST;

function __autoload($className){
	require_once './core/router.php';
	$router = new Router();
	$router->otherClassLoader($className);
}
$router = new Router();
if((isset($_SESSION['users_language'])) && (trim($_SESSION['users_language']) != '')){
	$language = $_SESSION['users_language'];
}
else {
	$language = "en";
}
$router->getLanguage($language);
$router->getVariableParser($request, $postVars);